package com.frcdi.qms.material.service;

import com.frcdi.qms.material.domain.Materials;
import com.frcdi.qms.material.mapper.MaterialsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName MaterialService
 * @Author Mr.Han
 * @Description //TODO $
 * @create 2024/7/8 17:38
 **/
@Service
public class MaterialService {
    @Autowired
    private MaterialsMapper materialMapper;

    public void addMaterial(Materials material) {
        materialMapper.insert(material);
    }

    public void updateMaterial(Materials material) {
        materialMapper.update(material);
    }

    public void deleteMaterial(Integer id) {
        materialMapper.delete(id);
    }

    public Materials getMaterialById(Integer id) {
        return materialMapper.selectById(id);
    }

    public List<Materials> getAllMaterials() {
        return materialMapper.selectAll();
    }
}